<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 微信自定义菜单
 */
class CreateWxMenu extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //微信用户表
        Schema::create('wx_menus', function (Blueprint $table) {
            $table->increments('menu_id')->comment('菜单ID');
            $table->unsignedInteger('parent_id')->default(0)->comment('父级菜单ID');
            $table->string('type', 20)->comment('菜单的响应动作类型');
            $table->string('name', 100)->default('')->comment('菜单标题');
            $table->tinyInteger('is_conditional')->default(0)->comment('是否为个性化菜单');
            $table->string('key', 50)->default('')->comment('菜单KEY值，用于消息接口推送');
            $table->string('url', 250)->default('')->comment('网页链接');
            $table->string('media_id', 150)->default('')->comment('素材ID');
            $table->string('appid', 50)->default('')->comment('小程序的appid');
            $table->string('pagepath', 60)->default('')->comment('小程序的页面路径');
            $table->text('matchrule')->comment('菜单匹配规则');
            $table->unsignedSmallInteger('order_num')->default(0)->comment('排序数字');
            $table->softDeletes();
            $table->timestamps();
            $table->index(['parent_id','name','type','deleted_at'], 'idnex1');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::dropIfExists('wx_menus');
    }
}
